<template>
  <footer class="footer">
    <!-- This should be `0 items left` by default -->
    <span class="todo-count"
      ><strong>surplus</strong><span>{{ conter }}</span></span
    >
    <!-- Remove this if you don't implement routing -->
    <ul class="filters" @click="$emit('Add', qihun)">
      <li>
        <a
          :class="{ selected: qihun === 'all' }"
          @click="qihun = 'all'"
          href="#/"
          >All</a
        >
      </li>
      <li>
        <a
          :class="{ selected: qihun === 'no' }"
          @click="qihun = 'no'"
          href="#/active"
          >Active</a
        >
      </li>
      <li>
        <a
          :class="{ selected: qihun === 'yes' }"
          @click="qihun = 'yes'"
          href="#/completed"
          >Completed</a
        >
      </li>
    </ul>
    <!-- Hidden if no completed items are left ↓ -->
    <button class="clear-completed"
    @click="$emit('suoyou')">Clear completed</button>
  </footer>
</template>

<script>
export default {
  props: ["arr"],
  data() {
    return {
      qihun: "all", //on,yes
    };
  },
  computed: {
    conter() {
      return this.arr.filter((obj) => obj.isDone === true).length;
    },
  },
};
</script>

<style>
</style>